import tkinter as tk

window=tk.Tk()
window.title('my window')
window.geometry('200x200')

var1=tk.StringVar()

l=tk.Label(window,bg='yellow',width=4,textvariable=var1)
l.pack()

def print_selection():
    value=lb.get(lb.curselection()) #将listbox 选中东西的值获取到
    var1.set(value)

bl=tk.Button(window,text='pring selection',width=15,height=1,command=print_selection)
bl.pack()

var2=tk.StringVar()
var2.set((11,22,33,44))
lb=tk.Listbox(window,listvariable=var2)
list_items=[1,2,3,4]
for item in list_items:   #循环数组插入 listbox
    lb.insert('end',item)

lb.pack()

window.mainloop()